package com.zit.java.controller;


import com.zit.java.pojo.PersonalSalaryShow;
import com.zit.java.service.personal.PersonalSalaryService;
import com.zit.java.util.object.TableData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;


@RequestMapping("personal")
@Controller
public class PersonalSalaryController {

    @Autowired
    PersonalSalaryService service;


    @RequestMapping(value = "toPersonalPag")
    public String personalPag(){
        return "personalsalary/personalsalary";
    }

    /**
     * 展示个人薪资发放的详情
     * @return
     */
    @RequestMapping("showallmsg")
    @ResponseBody
    public TableData<PersonalSalaryShow> showAllMsg(){
        TableData<PersonalSalaryShow> tableData = new TableData<>();
        List<PersonalSalaryShow> rest = service.queryAllData();
        rest.forEach(obj->{
            System.out.println(obj.getIssueDate());
        });
        tableData.setMsg("ok");
        tableData.setData(rest);
        tableData.setCode(0);
        tableData.setCount(rest.size());
        return tableData;
    }

    /**
     * 到统一服务平台
     * @param
     * @param
     * @return
     */
    @RequestMapping("/toService")
    public  String showSearchMsg(){
        return "personalsalary/service";
    }


}
